<?php
class Admin_OpenIdModel extends BlogAdminBaseModel
{
    /**
     * Check is site in the trusted sites list
     *
     * @param string $url
     * @return bool
     */
    public function isSiteTrusted($url)
    {
        $res = Doctrine::getTable('OpenIdTrustedSite')->find(strtolower($url));
        return $res instanceof OpenidTrustedSite;
    }


    /**
     * Add site to the trusted sites list
     *
     * @param string $url
     */
    public function addSiteToTrusted($url)
    {
        try {
            $conn = $this->getPdo();
            $oits = new OpenidTrustedSite();
            $oits->id = strtolower($url);
            $oits->site_url = $url;
            $oits->save($conn);
        } catch (Doctrine_Exception $e) {
            
        }
    }
}
